package com.study.kt._00test.listitera

import kotlin.concurrent.thread

fun main() {
    val list = mutableListOf("a", "b", "c", "d")

    thread {
        val iterator = list.iterator()
        while (iterator.hasNext()) {
            println(iterator.next())
        }
        Thread.sleep(200)
    }

    thread {
        val iterator = list.iterator()
        while (iterator.hasNext()) {
            list.remove(iterator.next())
        }
    }
}